Mega Code Archive
String Functions
1) A Complicated Regular Expression Comparison
2) A Simple Regular Expression Comparison
3) An example regular expression
4) Ascii(s)
5) Btrim(123example 332, 123)
6) Btrim(s [, t])
7) Char_length(s)
8) Chr(n)
9) Get negation
10) Get_byte(string, offset)
11) If space is not enough for display
12) ILIKE demo
13) Initcap(s)
14) Length(s)
15) Length(string) int Length of binary string
16) Lower()
17) Lpad(name, 12, -)
18) Ltrim
19) Ltrim( whitespace example)
20) Ltrim(name, )
21) Octet_length(string)
22) Octet_length(string) int Number of bytes in binary string
23) Position(char IN string)
24) Position(substring in string) int Location of specified substring
25) Regular expressions operator
26) Remove the longest string consisting only of bytes in bytes from the start and
27) Remove the longest string containing only the bytes in bytes from the start and end
28) Repeat(string, 2)
29) Rpad(name, 12, -)
30) Rpad(whitespace example, 30)
31) Rtrim()
32) Rtrim(whitespace example )
33) Set_byte(string, offset, newvalue)
34) Simple translate function example
35) Strpos
36) Substr
37) Substr(1234, 3)
38) Substr(1234, 3) (substring the digits)
39) Substr(CAST (1234 AS text), 3)
40) Substr(CAST (varchar 1234 AS text), 3)
41) Substr(varchar 1234, 3)
42) Substring(name FROM 3 FOR 5)
43) Substring(s FROM n FOR l)
44) Substring(string [from int] [for int]) bytea Extract substring
45) To_ascii(Multibyte Source, LATIN1)
46) To_char
47) To_char(1 0, 9th Place)
48) To_char(123456789, 00999999999)
49) To_char(123456789, 999999999)
50) To_char(123456789, 999G999G999D99)
51) To_char(start_date, YYYY-MM-DD HH24
52) To_number($2,900 00, L9G999D99)
53) To_number(00123456789, 00999999999)
54) To_number(123,456,789 00, 999G999G999D99)
55) To_number(123456789, 999999999)
56) Translate(name, aeiouAEIOU, )
57) Translate(s, f, r)
58) Trim(LEADING 0 FROM id)
59) Trim(side f FROM s)
60) Trim(TRAILING a FROM name)
61) Upper(s)
62) Using ascii() function
63) Using char_length( string )